package com.dianning.web.action.car;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.*;

import com.dianning.bean.Area;
import com.dianning.bean.ChannelContact;
import com.dianning.bean.Company;
import com.dianning.bean.Info;
import com.dianning.bean.InfoExpand;
import com.dianning.bean.Money;
import com.dianning.bean.Parameter;
import com.dianning.bean.Profile;
import com.dianning.bean.Resume;
import com.dianning.bean.TradingArea;
import com.dianning.bean.UserDetail;
import com.dianning.bean.UserInfo;
import com.dianning.bean.Visitor;
import com.dianning.comm.ChannelConfig;
import com.dianning.comm.Constant;
import com.dianning.comm.DianningUtil;
import com.dianning.comm.OrderObj;
import com.dianning.comm.Util;
import com.dianning.exception.DianningException;
import com.dianning.service.AreaService;
import com.dianning.service.ChannelService;
import com.dianning.service.InfoService;
import com.dianning.service.ParameterService;
import com.dianning.service.UserInfoService;
import com.dianning.service.VisitorService;
import com.dianning.service.web.PageList;
import com.dianning.service.web.Pages;
import com.dianning.web.action.BaseAction;
import com.dianning.web.interceptor.RemoteAddrAware;
import com.dianning.web.interceptor.UserSessionAware;
import com.dianning.web.servlet.UserSession;
import com.dianning.web.ui.OptionsLong;
import com.dianning.web.ui.OptionsString;

public class Pinche extends BaseAction implements UserSessionAware{

	private static final Log logger = LogFactory.getLog(Pinche.class);
	
	private InfoService infoService;
	private ChannelService channelService;
	private ParameterService parameterService;
	private AreaService areaService;
	private UserInfoService userInfoService;


	public InfoService getInfoService() {
		return infoService;
	}

	public void setInfoService(InfoService infoService) {
		this.infoService = infoService;
	}
	
	public ChannelService getChannelService() {
		return channelService;
	}

	public void setChannelService(ChannelService channelService) {
		this.channelService = channelService;
	}

	public ParameterService getParameterService() {
		return parameterService;
	}

	public void setParameterService(ParameterService parameterService) {
		this.parameterService = parameterService;
	}

	public AreaService getAreaService() {
		return areaService;
	}

	public void setAreaService(AreaService areaService) {
		this.areaService = areaService;
	}

	public UserInfoService getUserInfoService() {
		return userInfoService;
	}

	public void setUserInfoService(UserInfoService userInfoService) {
		this.userInfoService = userInfoService;
	}
	
	private UserSession userSession;

	public UserSession getUserSession() {
		return userSession;
	}

	public void setUserSession(UserSession userSession) {
		this.userSession = userSession;
	}
	
	private List carPincheshijianTypeList = new ArrayList();
	private List carPincheTypeList = new ArrayList();
	private List chufahourList = new ArrayList();
	private List chufaminuteList = new ArrayList();

	public List getCarPincheshijianTypeList() {
		return carPincheshijianTypeList;
	}

	public void setCarPincheshijianTypeList(List carPincheshijianTypeList) {
		this.carPincheshijianTypeList = carPincheshijianTypeList;
	}

	public List getCarPincheTypeList() {
		return carPincheTypeList;
	}

	public void setCarPincheTypeList(List carPincheTypeList) {
		this.carPincheTypeList = carPincheTypeList;
	}

	public List getChufahourList() {
		return chufahourList;
	}

	public void setChufahourList(List chufahourList) {
		this.chufahourList = chufahourList;
	}

	public List getChufaminuteList() {
		return chufaminuteList;
	}

	public void setChufaminuteList(List chufaminuteList) {
		this.chufaminuteList = chufaminuteList;
	}

	private void setCarPincheshijianTypeListValues(){
		List l = this.getParameterService().findParameters("carPincheshijianType", 2, null, "orders", 0);
		for(int i=0;i<l.size();i++){
			Parameter p = (Parameter) l.get(i);
			carPincheshijianTypeList.add(new OptionsLong(p.getId(), p.getParamName()));
		}
	}
	private void setCarPincheTypeListValues(){
		List l = this.getParameterService().findParameters("carPincheType", 2, null, "orders", 0);
		for(int i=0;i<l.size();i++){
			Parameter p = (Parameter) l.get(i);
			carPincheTypeList.add(new OptionsLong(p.getId(), p.getParamName()));
		}
	}
	private void setChufahourListValues(){
		for(int i=1;i<=24;i++){
			chufahourList.add(new OptionsString(String.valueOf(i), String.valueOf(i)));
		}
	}
	private void setChufaminuteListValues(){
			chufaminuteList.add(new OptionsString("00", "00"));
			chufaminuteList.add(new OptionsString("10", "10"));
			chufaminuteList.add(new OptionsString("20", "20"));
			chufaminuteList.add(new OptionsString("30", "30"));
			chufaminuteList.add(new OptionsString("40", "40"));
			chufaminuteList.add(new OptionsString("50", "50"));
	}	
	private void initValues(){
		setCarPincheshijianTypeListValues();
		setCarPincheTypeListValues();
		setChufahourListValues();
		setChufaminuteListValues();
		this.setBigChannel(this.getChannelService().findChannelContactById(this.bid));
		this.setSmallChannel(this.getChannelService().findChannelContactById(this.sid));
		this.setArea(this.getAreaService().findAreaById(this.areaId));
		if(this.areaId == -1){
			this.areaId = 0;
		}
		if(this.tid == -1){
			this.tid = 0;
		}
		this.setTradingArea(this.getAreaService().findTradingAreaById(this.tid));
	}
	
	private long id;
	private long bid = ChannelConfig.CAR_ID;
	private long sid = ChannelConfig.CAR_PINCHE_ID;
	private long areaId = -1;
	private long allTop = 1;
	private long tid = -1;
	private String title = "";
	private int isbiz = -1;
	private boolean biz = false;
	private boolean profile = true;
	private String content;
	private List photo;
	private int photonum;
	private String linkman;
	private String phone;
	
	private String address;
	private long objtype = -1;
	private long carMudiType = -1;
	private String startStation = "";
	private String endStation = "";
	private String site;
	private long carPincheshijianType = -1;
	private long carPincheType = -1;
	private String zidingyishijian;
	private String chufahour = "";
	private String chufaminute = "";
	private String minPrice="";
	private String maxPrice="";
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getBid() {
		return bid;
	}

	public void setBid(long bid) {
		this.bid = bid;
	}

	public long getSid() {
		return sid;
	}

	public void setSid(long sid) {
		this.sid = sid;
	}public long getAreaId() {
		return areaId;
	}

	public void setAreaId(long areaId) {
		this.areaId = areaId;
	}

	public long getAllTop() {
		return allTop;
	}

	public void setAllTop(long allTop) {
		this.allTop = allTop;
	}


	public long getTid() {
		return tid;
	}

	public void setTid(long tid) {
		this.tid = tid;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public long getObjtype() {
		return objtype;
	}

	public void setObjtype(long objtype) {
		this.objtype = objtype;
	}

	public String getMinPrice() {
		return minPrice;
	}

	public void setMinPrice(String minPrice) {
		this.minPrice = minPrice;
	}

	public String getMaxPrice() {
		return maxPrice;
	}

	public void setMaxPrice(String maxPrice) {
		this.maxPrice = maxPrice;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getLinkman() {
		return linkman;
	}

	public void setLinkman(String linkman) {
		this.linkman = linkman;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public int getIsbiz() {
		return isbiz;
	}

	public void setIsbiz(int isbiz) {
		this.isbiz = isbiz;
	}

	public boolean isBiz() {
		return biz;
	}

	public void setBiz(boolean biz) {
		this.biz = biz;
	}

	public boolean isProfile() {
		return profile;
	}

	public void setProfile(boolean profile) {
		this.profile = profile;
	}


	public List getPhoto() {
		return photo;
	}

	public void setPhoto(List photo) {
		this.photo = photo;
	}

	public int getPhotonum() {
		return photonum;
	}

	public void setPhotonum(int photonum) {
		this.photonum = photonum;
	}
	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public long getCarMudiType() {
		return carMudiType;
	}

	public void setCarMudiType(long carMudiType) {
		this.carMudiType = carMudiType;
	}

	public String getStartStation() {
		return startStation;
	}

	public void setStartStation(String startStation) {
		this.startStation = startStation;
	}

	public String getEndStation() {
		return endStation;
	}

	public void setEndStation(String endStation) {
		this.endStation = endStation;
	}

	public String getSite() {
		return site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	public long getCarPincheshijianType() {
		return carPincheshijianType;
	}

	public void setCarPincheshijianType(long carPincheshijianType) {
		this.carPincheshijianType = carPincheshijianType;
	}

	public long getCarPincheType() {
		return carPincheType;
	}

	public void setCarPincheType(long carPincheType) {
		this.carPincheType = carPincheType;
	}

	public String getChufahour() {
		return chufahour;
	}

	public void setChufahour(String chufahour) {
		this.chufahour = chufahour;
	}

	public String getChufaminute() {
		return chufaminute;
	}

	public void setChufaminute(String chufaminute) {
		this.chufaminute = chufaminute;
	}

	public String getZidingyishijian() {
		return zidingyishijian;
	}

	public void setZidingyishijian(String zidingyishijian) {
		this.zidingyishijian = zidingyishijian;
	}
	
	private Info info;
	private List sameAreas;
	private List sameUsers;
	private PageList pageList;
	private List areas;
	private String domain = Constant.DOMAIN;
	private String profileDomain = Constant.PROFILE_DOMAIN;
	private ChannelContact bigChannel;
	private ChannelContact smallChannel;
	private Area area;
	private TradingArea tradingArea;
	
	public Info getInfo() {
		return info;
	}

	public void setInfo(Info info) {
		this.info = info;
	}
	
	public List getSameAreas() {
		return sameAreas;
	}

	public void setSameAreas(List sameAreas) {
		this.sameAreas = sameAreas;
	}

	public List getSameUsers() {
		return sameUsers;
	}

	public void setSameUsers(List sameUsers) {
		this.sameUsers = sameUsers;
	}

	public PageList getPageList() {
		return pageList;
	}

	public void setPageList(PageList pageList) {
		this.pageList = pageList;
	}

	public List getAreas() {
		return areas;
	}

	public void setAreas(List areas) {
		this.areas = areas;
	}
	

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public String getProfileDomain() {
		return profileDomain;
	}

	public void setProfileDomain(String profileDomain) {
		this.profileDomain = profileDomain;
	}

	public ChannelContact getBigChannel() {
		return bigChannel;
	}

	public void setBigChannel(ChannelContact bigChannel) {
		this.bigChannel = bigChannel;
	}

	public ChannelContact getSmallChannel() {
		return smallChannel;
	}

	public void setSmallChannel(ChannelContact smallChannel) {
		this.smallChannel = smallChannel;
	}

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	public TradingArea getTradingArea() {
		return tradingArea;
	}

	public void setTradingArea(TradingArea tradingArea) {
		this.tradingArea = tradingArea;
	}

	public String execute() {
		try {
			return this.executeMethod(this.getAction());
		} catch (Exception e) {
			logger.error(e);
			return ERROR;
		}
	}

	public String index(){
		this.setInfo(this.getInfoService().findInfoById(this.id));
		if(this.getInfo() == null){
			return "infodisable";
		}else{
			if(this.getInfo().getValidated() == 2){
				return "infodisable";
			}
		}
		this.setSameAreas(this.getInfoService().findInfos(id,-1, this.getInfo().getCcid(), 1, 1, -1, "addTime", 1, 1, 5));
		this.setSameUsers(this.getInfoService().findInfos(id,this.getInfo().getUid(), this.getInfo().getCcid(), 1, 1, -1, "addTime", 1, 1, 5));
        return "index";
	}
	
	public String list(){
		if(this.areaId == 0){
			this.areaId = -1;
		}
		if(this.tid == 0){
			this.tid = -1;
		}
		this.setAreas(this.getAreaService().findAreas("orders", 0));
		Pages pages = new Pages();
		pages.setPage(this.getPage());
		pages.setPerPageNum(Constant.PAGE_NUM);
		if (this.getTotal() > 0) {
			pages.setTotalNum(this.getTotal());
		}
		pages.setFileName("/car/pinche.action?action=list&areaId="+this.areaId+"&tid="+this.tid+"&isbiz="+this.isbiz+"&objtype="+this.objtype+"&carMudiType="+this.carMudiType+"&startStation="+this.startStation+"&endStation="+this.endStation+"&title="+this.title);
		List wherein = new ArrayList();
		if(this.objtype != -1){
			wherein.add("keyword='objtype' and ivalue="+this.objtype);		
		}
		if(carMudiType != -1){
			wherein.add("keyword='carMudiType' and ivalue=" + carMudiType);
		}
		if(StringUtils.isNotBlank(startStation)){
			wherein.add("keyword='startStation' and svalue like '%" + startStation + "%'");
		}
		if(StringUtils.isNotBlank(endStation)){
			wherein.add("keyword='endStation' and svalue like '%" + endStation + "%'");
		}
		
		OrderObj commend = new OrderObj();
		commend.setOrderBy("isCommend");
		commend.setAscOrDesc(1);
		OrderObj top = new OrderObj();
		if(this.areaId == -1){
			top.setOrderBy("isCityTop");
			top.setAscOrDesc(1);
		}else{
			this.allTop = -1;
			top.setOrderBy("isAreaTop");
			top.setAscOrDesc(1);
		}
		OrderObj up = new OrderObj();
		up.setOrderBy("upTime");
		up.setAscOrDesc(1);
		OrderObj[] oo = {commend,top,up};
		this.setPageList(this.getInfoService().findInfos(-1, -1, sid, areaId, tid, isbiz, 1, 1,-1,title, wherein, oo, pages));
		return "list";
	}
	public String post(){
		initValues();
		this.setAction("dopost");
		UserInfo ui = this.getUserInfoService().findUserInfoByUid(userSession.getUid());
		this.setLinkman(ui.getName());
		this.setPhone(ui.getUserDetail().getMobile());
		return "post";
	}
	
	public String dopost(){
		ChannelContact cc = this.getChannelService().findChannelContactById(this.sid);
		Info info = new Info();
		info.setCid(cc.getChannelId());
		info.setCcid(this.sid);
		info.setTitle(this.title);
		info.setContent(this.content);
		info.setAreaId(this.areaId);
		info.setTradingareaId(this.tid);
		info.setUid(this.userSession.getUid());
		info.setName(this.linkman);
		info.setTel(this.phone);
		info.setIsbiz(boolean2int(this.biz));
		info.setIsProfile(boolean2int(this.profile));
		info.setPhoto(this.photo);
		if(this.photo==null || this.photo.isEmpty()){
			info.setPhotonum(0);
		}else{
			info.setPhotonum(this.photo.size());
		}
		info.setAvatar("");
		info.setValidated(0);
		info.setStatus(1);
		info.setAddTime(new Date());
		info.setUpTime(new Date());
		info.setIsCityTop(0);
		info.setCityTopTime(new Date());
		info.setIsAreaTop(0);
		info.setAreaTopTime(new Date());
		info.setIsCommend(0);
		info.setCommendTime(new Date());
		
		List infoExpands = new ArrayList();
		//address
		InfoExpand infoAddress = new InfoExpand();
		infoAddress.setKeyword("address");
		infoAddress.setSvalue(this.address);
		infoAddress.setIvalue(0);
		infoExpands.add(infoAddress);
		//objtype
		InfoExpand infoObjtype = new InfoExpand();
		infoObjtype.setKeyword("objtype");
		if(this.objtype==0){
			infoObjtype.setSvalue("车主");
		}
		if(this.objtype==1){
			infoObjtype.setSvalue("乘客");
		}
		infoObjtype.setIvalue(this.objtype);
		infoExpands.add(infoObjtype);
		//carMudiType
		InfoExpand infoCarMudiType = new InfoExpand();
		infoCarMudiType.setKeyword("carMudiType");
		if(this.carMudiType==0){
			infoCarMudiType.setSvalue("上下班拼车");
		}
		if(this.carMudiType==1){
			infoCarMudiType.setSvalue("长途拼车");
		}
		if(this.carMudiType==2){
			infoCarMudiType.setSvalue("拼车自驾游");
		}
		infoCarMudiType.setIvalue(this.carMudiType);
		infoExpands.add(infoCarMudiType);
		//startStation
		InfoExpand infoStartStation = new InfoExpand();
		infoStartStation.setKeyword("startStation");
		infoStartStation.setSvalue(this.startStation);
		infoStartStation.setIvalue(0);
		infoExpands.add(infoStartStation);
		//endStation
		InfoExpand infoEndStation = new InfoExpand();
		infoEndStation.setKeyword("endStation");
		infoEndStation.setSvalue(this.endStation);
		infoEndStation.setIvalue(0);
		infoExpands.add(infoEndStation);
		//site
		InfoExpand infoSite = new InfoExpand();
		infoSite.setKeyword("site");
		infoSite.setSvalue(this.site);
		infoSite.setIvalue(0);
		infoExpands.add(infoSite);	
		//carPincheshijianType
		Parameter pPincheshijianType = this.getParameterService().findParameterById(this.carPincheshijianType);
		InfoExpand infoPincheshijianType = new InfoExpand();
		infoPincheshijianType.setKeyword("carPincheshijianType");
		infoPincheshijianType.setSvalue(pPincheshijianType.getParamName());
		infoPincheshijianType.setIvalue(this.carPincheshijianType);
		infoExpands.add(infoPincheshijianType);
		//zidingyishijian
		InfoExpand infoZidingyishijian = new InfoExpand();
		infoZidingyishijian.setKeyword("zidingyishijian");
		infoZidingyishijian.setSvalue(this.zidingyishijian);
		infoZidingyishijian.setIvalue(0);
		infoExpands.add(infoZidingyishijian);
		//chufahour
		InfoExpand infoChufahour = new InfoExpand();
		infoChufahour.setKeyword("chufahour");
		infoChufahour.setSvalue(this.chufahour);
		if(StringUtils.isBlank(this.chufahour)){
			infoChufahour.setIvalue(0);
		}else{
			infoChufahour.setIvalue(Long.parseLong(this.chufahour));
		}
		infoExpands.add(infoChufahour);
		//chufaminute
		InfoExpand infoChufaminute = new InfoExpand();
		infoChufaminute.setKeyword("chufaminute");
		infoChufaminute.setSvalue(this.chufaminute);
		if(StringUtils.isBlank(this.chufaminute)){
			infoChufaminute.setIvalue(0);
		}else{
			infoChufaminute.setIvalue(Long.parseLong(this.chufaminute));
		}
		infoExpands.add(infoChufaminute);
		//carPincheType
		Parameter pPincheType = this.getParameterService().findParameterById(this.carPincheType);
		InfoExpand infoPincheType = new InfoExpand();
		infoPincheType.setKeyword("carPincheType");
		infoPincheType.setSvalue(pPincheType.getParamName());
		infoPincheType.setIvalue(this.carPincheType);
		infoExpands.add(infoPincheType);	
		
		info = this.getInfoService().saveInfo(info, infoExpands);
		this.id = info.getId();
		return "dopost";
	}
	

	public String update(){
		
		this.setAction("doupdate");
		this.setInfo(this.getInfoService().findInfoById(this.id));
		if(this.getInfo() == null){
			return "infodisable";
		}else{
			if(this.getInfo().getValidated() == 2){
				return "infodisable";
			}
		}
		ChannelContact cc = this.getChannelService().findChannelContactById(this.sid);
		this.bid = cc.getParentId();
		this.sid = this.info.getCcid();
		this.areaId = this.info.getAreaId();
		this.tid = this.info.getTradingareaId();
		this.title = this.info.getTitle();
		this.content = this.info.getContent();
		this.linkman = this.info.getName();
		this.phone = this.info.getTel();
		this.biz = int2boolean(this.info.getIsbiz());
		this.profile = int2boolean(this.info.getIsProfile());
		this.photo = this.info.getPhoto();
		this.photonum = this.info.getPhotonum();

		//address
		InfoExpand infoAddress = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "address");
		this.address = infoAddress.getSvalue();
		//objtype
		InfoExpand infoObjtype = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "objtype");
		this.objtype = infoObjtype.getIvalue();
		//carMudiType
		InfoExpand infoMudiType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "carMudiType");
		this.carMudiType = infoMudiType.getIvalue();
		//startStation
		InfoExpand infoStartStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "startStation");
		this.startStation = infoStartStation.getSvalue();
		//endStation
		InfoExpand infoEndStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "endStation");
		this.endStation = infoEndStation.getSvalue();
		//site
		InfoExpand infoSite = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "site");
		this.site = infoSite.getSvalue();
		//carPincheshijianType
		InfoExpand infoPincheshijianType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "carPincheshijianType");
		this.carPincheshijianType = infoPincheshijianType.getIvalue();
		//zidingyishijian
		InfoExpand infoZidingyishijian = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "zidingyishijian");
		this.zidingyishijian = infoZidingyishijian.getSvalue();
		//chufahour
		InfoExpand infoChufahour = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "chufahour");
		this.chufahour = infoChufahour.getSvalue();
		//chufaminute
		InfoExpand infoChufaminute = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "chufaminute");
		this.chufaminute = infoChufaminute.getSvalue();
		//carPincheType
		InfoExpand infoPincheType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "carPincheType");
		this.carPincheType = infoPincheType.getIvalue();
		
		initValues();
		return "update";
	}
	
	public String doupdate(){
		ChannelContact cc = this.getChannelService().findChannelContactById(this.sid);
		Info info = this.getInfoService().findInfoById(this.id);
		info.setCid(cc.getChannelId());
		info.setCcid(this.sid);
		info.setTitle(DianningUtil.filterKeyword(this.title));
		info.setContent(DianningUtil.filterKeyword(this.content));
		info.setAreaId(this.areaId);
		info.setTradingareaId(this.tid);
		info.setUid(this.userSession.getUid());
		info.setName(this.linkman);
		info.setTel(this.phone);
		info.setIsbiz(boolean2int(this.biz));
		info.setIsProfile(boolean2int(this.profile));
		info.setPhoto(this.photo);
		if(this.photo==null || this.photo.isEmpty()){
			info.setPhotonum(0);
		}else{
			info.setPhotonum(this.photo.size());
		}
		
		List infoExpands = new ArrayList();
		//address
		InfoExpand infoAddress = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "address");
		infoAddress.setSvalue(this.address);
		infoExpands.add(infoAddress);
		//objtype
		InfoExpand infoObjtype = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "objtype");
		infoObjtype.setKeyword("objtype");
		if(this.objtype==0){
			infoObjtype.setSvalue("车主");
		}
		if(this.objtype==1){
			infoObjtype.setSvalue("乘客");
		}
		infoObjtype.setIvalue(this.objtype);
		infoExpands.add(infoObjtype);
		//carMudiType
		InfoExpand infoCarMudiType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "carMudiType");
		infoCarMudiType.setKeyword("carMudiType");
		if(this.carMudiType==0){
			infoCarMudiType.setSvalue("上下班拼车");
		}
		if(this.carMudiType==1){
			infoCarMudiType.setSvalue("长途拼车");
		}
		if(this.carMudiType==2){
			infoCarMudiType.setSvalue("拼车自驾游");
		}
		infoCarMudiType.setIvalue(this.carMudiType);
		infoExpands.add(infoCarMudiType);
		//startStation
		InfoExpand infoStartStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "startStation");
		infoStartStation.setKeyword("startStation");
		infoStartStation.setSvalue(this.startStation);
		infoStartStation.setIvalue(0);
		infoExpands.add(infoStartStation);
		//endStation
		InfoExpand infoEndStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "endStation");
		infoEndStation.setKeyword("endStation");
		infoEndStation.setSvalue(this.endStation);
		infoEndStation.setIvalue(0);
		infoExpands.add(infoEndStation);
		//site
		InfoExpand infoSite = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "site");
		infoSite.setKeyword("site");
		infoSite.setSvalue(this.site);
		infoSite.setIvalue(0);
		infoExpands.add(infoSite);	
		//carPincheshijianType
		Parameter pPincheshijianType = this.getParameterService().findParameterById(this.carPincheshijianType);
		InfoExpand infoPincheshijianType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "carPincheshijianType");
		infoPincheshijianType.setKeyword("carPincheshijianType");
		infoPincheshijianType.setSvalue(pPincheshijianType.getParamName());
		infoPincheshijianType.setIvalue(this.carPincheshijianType);
		infoExpands.add(infoPincheshijianType);
		//zidingyishijian
		InfoExpand infoZidingyishijian = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "zidingyishijian");
		infoZidingyishijian.setKeyword("zidingyishijian");
		infoZidingyishijian.setSvalue(this.zidingyishijian);
		infoZidingyishijian.setIvalue(0);
		infoExpands.add(infoZidingyishijian);
		//chufahour
		InfoExpand infoChufahour = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "chufahour");
		infoChufahour.setKeyword("chufahour");
		infoChufahour.setSvalue(this.chufahour);
		if(StringUtils.isBlank(this.chufahour)){
			infoChufahour.setIvalue(0);
		}else{
			infoChufahour.setIvalue(Long.parseLong(this.chufahour));
		}
		infoExpands.add(infoChufahour);
		//chufaminute
		InfoExpand infoChufaminute = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "chufaminute");
		infoChufaminute.setKeyword("chufaminute");
		infoChufaminute.setSvalue(this.chufaminute);
		if(StringUtils.isBlank(this.chufaminute)){
			infoChufaminute.setIvalue(0);
		}else{
			infoChufaminute.setIvalue(Long.parseLong(this.chufaminute));
		}
		infoExpands.add(infoChufaminute);
		//carPincheType
		Parameter pPincheType = this.getParameterService().findParameterById(this.carPincheType);
		InfoExpand infoPincheType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "carPincheType");
		infoPincheType.setKeyword("carPincheType");
		infoPincheType.setSvalue(pPincheType.getParamName());
		infoPincheType.setIvalue(this.carPincheType);
		infoExpands.add(infoPincheType);	

		info = this.getInfoService().updateInfo(info, infoExpands);
		return "doupdate";
	}









}
